package com.maizhi.interceptors;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import com.maizhi.controller.BaseController;

/**
 * web controller操作对象拦截器
 * 
 * 
 */

//@Component("springMVCInterceptor")
public class springMVCInterceptor extends HandlerInterceptorAdapter {
	
	public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object object, Exception exception) throws Exception {

	}

	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object object, ModelAndView modelAndView) throws Exception {

	}
	
	public boolean preHandle(HttpServletRequest request,HttpServletResponse response, Object handler) throws Exception {

		BaseController bc = (BaseController)handler ;
	    bc.setRequest(request);
	    bc.setResponse(response);
	    bc.setSession(request.getSession());
	    
	    return super.preHandle(request, response, handler);
	    
	}
}
